<script setup lang='ts'>
import { useSupplierWarehouse } from "./hooks/SupplierWarehouse";
import { PureTableBar } from "@/components/RePureTableBar";
const {
  rules,
  columns,
  loading,
  dataList,
  columns2,
  loading2,
  dataList2,
  AddSelete,
  AddVisible,
  DialogVisible,
  StubimAddFrom,
  RefStubimAddFrom,
  CloseEntryPlatform,
  SubtimEntryPlatform,
} = useSupplierWarehouse();
</script>

<template>
  <div class="main">
    <div class="haed_btn">
      <!-- <el-button type="primary" @click="DialogVisible = true">查看明细</el-button> -->
      <el-button type="primary" @click="AddVisible = true">添加到货</el-button>
    </div>
    <div class="inventory" id="inventory"></div>
    <!-- 库存 -->
    <el-dialog v-model="DialogVisible" :close-on-click-modal="false">
      <PureTableBar title="" class="list_hei">
        <template v-slot="{ size, checkList }">
          <pure-table border align-whole="center" showOverflowTooltip table-layout="auto" adaptive :loading="loading"
            size="small" :data="dataList" max-height="550" :columns="columns" :checkList="checkList" :header-cell-style="{
              background: 'var(--el-table-row-hover-bg-color)',
              color: 'var(--el-text-color-primary)'
            }">
          </pure-table>
        </template>
      </PureTableBar>
    </el-dialog>
    <!-- 添加到货 -->
    <ReDialog :width="500" :height="250" :models="AddVisible" @Closes="CloseEntryPlatform(RefStubimAddFrom)">
      <template #header>
        <h2 style="text-align: center;">添加到货</h2>
      </template>
      <template #main>
        <el-form label-width="100px" ref="RefStubimAddFrom" :rules="rules" :model="StubimAddFrom">
          <el-form-item label="产品名称" prop="name">
            <el-select v-model="StubimAddFrom.name" placeholder="请选择产品" style="width: 200px;">
              <el-option v-for="item in AddSelete" :key="item.categoryName" :label="item.categoryName"
                :value="item.categoryName" />
            </el-select>
          </el-form-item>
          <el-form-item label="到货数量" prop="num">
            <el-input v-model.number="StubimAddFrom.num" style="width: 200px;" type="number" />
          </el-form-item>
        </el-form>
      </template>
      <template #footer>
        <span class="dialog-footer">
          <el-button type="primary" @click="SubtimEntryPlatform(RefStubimAddFrom)"> 确定 </el-button>
          <el-button @click="CloseEntryPlatform(RefStubimAddFrom)"> 取消 </el-button>
        </span>
      </template>
    </ReDialog>
  </div>
</template>

<style scoped lang="scss">
@import url("@/style/CreditComm.scss");
$haed-hight: 50px;

.haed_btn {
  width: 100%;
  height: $haed-hight;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  padding: 10px;
  border-bottom: 1px solid #e7e7e7;
}

.inventory {
  width: 100%;
  height: calc(100% - $haed-hight);
}

:deep(.el-dialog__footer) {
  text-align: center;
}
</style>
